const uuidV4 = require('uuid/v4');

module.exports = function(sequelize, DataTypes) {
  return sequelize.define('choiceAuthUsers', {
    id: {
      type: DataTypes.UUID,
      primaryKey: true,
      defaultValue: () => {
        return uuidV4()
      }
    },
    avatarURL: {
      type: DataTypes.STRING,
      field: 'avatarURL',
      allowNull: true
    },
    name: {
      type: DataTypes.STRING,
      field: 'name',
      allowNull: false
    },
    password: {
      type:DataTypes.STRING,
      field: 'password',
      allowNull: false
    },
    roles: {
      type: DataTypes.STRING,
      field: 'roles',
      allowNull: false
    },
    email: {
      type: DataTypes.STRING,
      field: 'email',
      allowNull: true
    },
    createAt: {
      type: DataTypes.DATE
    }
  },
  {
    tableName: 'choice_auth_users'
  })
}